package org.rc.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import org.rc.dto.SxjAddDto;
import org.rc.dto.SxjUpdateDto;

@Data
public class Sxj {
    @TableId(value = "id",type = IdType.AUTO)
    private Long id;
    private String name;
    private String ip;
    private Integer port;
    private String userName;
    private String password;


    public static Sxj getInstance(SxjAddDto sxjAddDto){
        Sxj sxj = new Sxj();
        sxj.setName(sxjAddDto.getName());
        sxj.setIp(sxjAddDto.getIp());
        sxj.setPort(sxjAddDto.getPort());
        sxj.setUserName(sxjAddDto.getUserName());
        sxj.setPassword(sxjAddDto.getPassword());
        return sxj;
    }

    public static Sxj getInstance(SxjUpdateDto sxjUpdateDto){
        Sxj sxj = new Sxj();
        sxj.setId(sxjUpdateDto.getId());
        sxj.setName(sxjUpdateDto.getName());
        sxj.setIp(sxjUpdateDto.getIp());
        sxj.setPort(sxjUpdateDto.getPort());
        sxj.setUserName(sxjUpdateDto.getUserName());
        sxj.setPassword(sxjUpdateDto.getPassword());
        return sxj;
    }
}
